<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>echo</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4><a name = "tag_001_014_510">&nbsp;</a>NAME</h4><blockquote>
echo - write arguments to standard output
</blockquote><h4><a name = "tag_001_014_511">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

echo <b>[</b><i>string</i> ...<b>]</b>
</code>
</pre>
</blockquote><h4><a name = "tag_001_014_512">&nbsp;</a>DESCRIPTION</h4><blockquote>
The
<i>echo</i>
utility will write its arguments to standard output,
followed by a newline character.
If there are no arguments, only the newline character will be written.
</blockquote><h4><a name = "tag_001_014_513">&nbsp;</a>OPTIONS</h4><blockquote>
The
<i>echo</i>
utility will not recognise the
--
argument in the manner specified by Guideline 10 of the <b>XBD</b> specification, <a href="../xbd/utilconv.html#usg"><b>Utility Syntax Guidelines</b>&nbsp;</a> ;
--
will be recognised as a string operand.
<p>
Implementations will not support any options.
</blockquote><h4><a name = "tag_001_014_514">&nbsp;</a>OPERANDS</h4><blockquote>
The following operands are supported:
<dl compact>

<dt><i>string</i><dd>A string to be written to standard output.
If any operand is
-n,
it will be treated as a string, not an option.
The following character sequences will be
recognised within any of the arguments:
<dl compact>

<dt><b>\a</b><dd>Write an
alert
character.

<dt><b>\b</b><dd>Write a
backspace
character.

<dt><b>\c</b><dd>Suppress the
newline
character that otherwise follows
the final argument in the output.
All characters following the
\c
in the arguments will be ignored.

<dt><b>\f</b><dd>Write a
form-feed
character.

<dt><b>\n</b><dd>Write a
newline
character.

<dt><b>\r</b><dd>Write a
carriage-return
character.

<dt><b>\t</b><dd>Write a
tab
character.

<dt><b>\v</b><dd>Write a
vertical-tab
character.

<dt><b>\\</b><dd>Write a
backslash
character.

<dt><b>\0</b><i>num</i><dd>Write an 8-bit value that is the zero-, one-, two- or
three-digit octal number
<i>num .</i>

</dl>
<p>
</dl>
</blockquote><h4><a name = "tag_001_014_515">&nbsp;</a>STDIN</h4><blockquote>
Not used.
</blockquote><h4><a name = "tag_001_014_516">&nbsp;</a>INPUT FILES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_517">&nbsp;</a>ENVIRONMENT VARIABLES</h4><blockquote>
The following environment variables affect the execution of
<i>echo</i>:
<dl compact>

<dt><i>LANG</i><dd>Provide a default value for the internationalisation variables
that are unset or null.
If
<i>LANG</i>
is unset or null, the corresponding value from the
implementation-dependent default locale will be used.
If any of the internationalisation variables contains an invalid setting, the
utility will behave as if none of the variables had been defined.


<dt><i>LC_ALL</i><dd>
If set to a non-empty string value,
override the values of all the other internationalisation variables.

<dt><i>LC_CTYPE</i><dd>
Determine the
locale for the interpretation of sequences of bytes of text data as
characters (for example, single- as opposed to multi-byte characters
in arguments).

<dt><i>LC_MESSAGES</i><dd>
Determine the locale that should be used to affect
the format and contents of diagnostic
messages written to standard error.

<dt><i>NLSPATH</i><dd>
Determine the location of message catalogues
for the processing of
<i>LC_MESSAGES .
</i>
</dl>
</blockquote><h4><a name = "tag_001_014_518">&nbsp;</a>ASYNCHRONOUS EVENTS</h4><blockquote>
Default.
</blockquote><h4><a name = "tag_001_014_519">&nbsp;</a>STDOUT</h4><blockquote>
The
<i>echo</i>
utility arguments will be separated by single
space characters
and a newline character will follow the last argument.
Output transformations will occur based on the escape
sequences in the input; see the OPERANDS section.
</blockquote><h4><a name = "tag_001_014_520">&nbsp;</a>STDERR</h4><blockquote>
Used only for diagnostic messages.
</blockquote><h4><a name = "tag_001_014_521">&nbsp;</a>OUTPUT FILES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_522">&nbsp;</a>EXTENDED DESCRIPTION</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_523">&nbsp;</a>EXIT STATUS</h4><blockquote>
The following exit values are returned:
<dl compact>

<dt>0<dd>Successful completion.

<dt>&gt;0<dd>An error occurred.

</dl>
</blockquote><h4><a name = "tag_001_014_524">&nbsp;</a>CONSEQUENCES OF ERRORS</h4><blockquote>
Default.
</blockquote><h4><a name = "tag_001_014_525">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
It is not possible to use
<i>echo</i>
portably across all systems that are not XSI-conformant unless both
<b>-n</b>
(as the first argument)
and escape sequences are omitted.
<p>
The
<i><a href="printf.html">printf</a></i>
utility
can be used portably to emulate any of
the traditional behaviours of the
<i>echo</i>
utility as follows:
<ul>
<p>
<li>
The XSI
<i>echo</i>
is equivalent to:
<pre>
<code>
printf "%b\n" "$*"
</code>
</pre>
<p>
<li>
The BSD
<i>echo</i>
is equivalent to:
<pre>
<code>
if [ "X$1" = "X-n" ]
then
    shift
    printf "%s" "$*"
else
    printf "%s\n" "$*"
fi
</code>
</pre>
<p>
</ul>
<p>
New applications are encouraged to use
<i><a href="printf.html">printf</a></i>
instead of
<i>echo</i>.
</blockquote><h4><a name = "tag_001_014_526">&nbsp;</a>EXAMPLES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_527">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_528">&nbsp;</a>SEE ALSO</h4><blockquote>
<i><a href="printf.html">printf</a></i>.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>
